package com.ybwh.springboot2.common.fastjson.enumat;


import com.ybwh.springboot2.common.enums.CodeTextEnum;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * <p>
 * 标注VO字段对应的枚举类
 * </p>
 *
 * @author fanbeibei
 * @version 1.0.0
 * @date 2022/3/14 18:05
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD})
@Constraint(validatedBy = EnumFieldValidator.class)
public @interface EnumField {
    /**
     * 对应的枚举
     *
     * @return
     */
    Class<? extends CodeTextEnum> enumClass();

    //--------------------以下是校验用-----------------------------------------------------
    String message() default "值不在枚举范围内";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
